package com.gpms.service.systemInit;

import java.util.List;

import com.gpms.bean.SchoolTimePoint;
import com.gpms.bean.TimePointClass;
import com.gpms.dao.HibernateDaoFactory;
import com.gpms.dao.IHibernateDao;

public class MultiTimeImp implements IMultiTime {

	public String set(List<Object> timePoint) {
		String result="";
		IHibernateDao udao= HibernateDaoFactory.createDao("timePointDao");
		try
		{
			result = udao.save(timePoint);
		}catch(Exception e)
		{
			e.printStackTrace();
			return "input";
		}
		return result;
	}

	public boolean alreadSet() {
		return false;
	}
	public List<Object> showTimeClass() {
		String hql="from TimePointClass where TimePointType='"+0+"' order by TimePointClassNum asc";
		return show(hql);
	}
	public List<Object> showTimePoint() {
		String hql="from SchoolTimePoint sp where sp.canDo='"+0+"' order by sp.timePointClass.TimePointClassNum asc";
		return show(hql);
		
	}
	public List<Object> show(String hql)
	{
		IHibernateDao udao= HibernateDaoFactory.createDao("timePointDao");
		List<Object> tp= udao.selectByHql(hql);
		return tp;
	}

	public List<Object> showOneTime(int timeClassNum) {
		String hql="from SchoolTimePoint stp where stp.canDo='"+0+"' and stp.timePointClass.TimePointClassNum="+timeClassNum+"";
		IHibernateDao dao= HibernateDaoFactory.createDao("timePointDao");
		List<Object> obj = dao.selectByHql(hql);
		return obj;
	}
}
